1. Field of the Invention
The present invention relates to a distributed database system for more rapidly executing transactions, especially commit preparation processing and commit processing of transactions.
2. Background of the Invention
A distributed database system comprises a plurality of computers, each of which has a database. The plurality of computers are interconnected by communication lines. Each computer managers its own database (computer and its associated database are herein referred to as "site" herein). When a site is supplied with a data processing request through an input device, firstly a computer in the site checks which database includes the necessary data for the requested processing, by referring to a table of stored data names and corresponding locations. If the data is included in the site's own database, the computer reads the data from this database, executes the data processing and writes the data processing result into this database (a series of these processes is called a "transaction"). If the data is included in a database of another site, the computer sends the processing request to the other site, the database of which includes the data. Then the computer of the other site reads the data from its database, executes the data processing at the other site and writes the data processing result to its database, according to the processing request. In this case, if a site is supplied with a data processing request, which requires the processing of both data in the site's own database and data in a database of another site, these sites must maintain consistent data in their respective databases. In short, it is necessary for the data processing to update the data consistently in both databases, and not to update the data in only one database without a corresponding change in the other database. Accordingly, in the prior art, sites of a distributed database system must execute commit processing after any required data processing. Commit processing as used herein means that a site, which was supplied with a data processing request through an input device, becomes a coordinator (supervisor) and another site, which participates in the data processing, becomes a participant. It is necessary for the coordinator and participant to communicate with each other from the end of data processing (called the processing end) to the end of the writing of the data processing result to the database (called the transaction end), to maintain consistent data in the databases.
FIG. 1 shows a construction of a distributed database system. This system has three sites A, B and C. Also shown in FIG. 1 is the time necessary for each communication line to send a message between each two sites. FIG. 2 shows a time table of a typical commit processing according to the prior art. It is assumed that a data processing request is supplied to site B and the data processing requires updating of data in both database B of site B and database C of site C. For example, Mr. X goes to the New York branch (site B) of American Bank. Mr. X wants to remit money from his account in the New York branch to Mr. Y's account in the Washington branch (site C). Mr. X requests the bank to remit a fixed amount of money to Mr. Y. Site B subtracts the amount from Mr. X's account in database B and sends the data processing request to add the amount to Mr. Y's account to site C. Site C adds the amount to Mr. Y's account in database C. In this example, when site B becomes the coordinator, site B sends the data processing request to site C. When site C receives the data processing request, site C becomes the participant. Then sites B and C execute the processing by using data in their respective databases. When sites B and C have finished executing the processing (processing end), they each store the data processing result in temporary storage, which is not a part of either database. Then, site C sends a processing end message (STE) to site B. When site B receives the processing end message (STE) from site C, site B prepares to commit process (PC). Thus, site B is prepared to write the data processing result from its temporary storage to its database. Then site B sends a commit preparation completion message (PCM) to site C. When site C receives the commit preparation message from the site B, site C also prepares to commit process (PC). Site C sends an acknowledgment message (ACK) to site B. When site B receives the acknowledgment message from site C, site B executes the commit process (CO). Thus, site B writes the data processing result from its temporary storage to database B. Then site B sends a commit completion message (COM) to site C. When site C receives the commit message from site B, site C also executes commit process (CO). Then site C sends an acknowledgment message (ACK) to site B. When site B receives the acknowledgment message, the transaction comprising the data processing, commit preparation process and commit process is completed. However, in this case, as shown in FIG. 1, it takes twenty seconds to a send message between sites B and C. Therefore, as shown in FIG. 2, it takes one hundred ten seconds to complete the transaction from processing end to transaction end.
FIG. 3 shows another time table of commit process according to the prior art, in case the difference between the processing end time of site B (zero) and the processing end time of site C (thirty seconds) is large. In the same way as FIG. 2, it is necessary for sites B and C to send many messages (STE, PCM, ACK, COM) to each other. As shown in FIG. 3, it takes one hundred thirty seconds to complete the transaction from processing end to transaction end.
As mentioned above, according to the prior art, it takes a long time to a complete transaction between a plurality of sites.
Accordingly, it is an object of the present invention to reduce the time from processing end to transaction end in a distributed database system.